use Person::Persons;
package Person::Student;

our @ISA = qw(Persons); 

#sub new {
#    my ($class) = @_;
#    # Call the constructor of the parent class, Person.
#    my $self = $class->SUPER::new( );
#    # Add few more attributes
#    bless $self, $class;
#    return $self;
#}

sub grades{
	$self = shift;
	my $self->{$grades} = {};
	my $key = 1;
	my $subject;
	my $note;
	while(@_){
		if($key){
			$subject = shift;
			$key = 0;
		}else{
			$note = shift;
			$grades->{$subject} = $note;	
			$key = 1;
		}
	}
	while( my ($k, $v) = each $grades){
		print "Subject $k : $v.\n";
	}	
}
sub avg{
	my $count = 0;
	my $result = 0;
	while(my ($k, $v) = each $grades){
		$result += $v;
		$count++;
	}
	$result /= $count;
	printf "Student's average : %1.2f\n", $result;
}
1;
